
#ifndef _DRV_ADC_DEFINITIONS_H
#define _DRV_ADC_DEFINITIONS_H
#include "driver/driver_common.h"
#include "gd32f4xx_adc.h"
#include "osal/osal.h"

#ifdef __cplusplus // Provide C++ Compatibility

extern "C" {

#endif

#define DRV_ADC_INDEX_0 0
#define DRV_ADC_INDEX_1 1
#define DRV_ADC_INDEX_2 2

typedef enum {
  ADC_ID_0 = ADC0,
  ADC_ID_1 = ADC1,
  ADC_ID_2 = ADC2,
  ADC_NUMBER_OF_MODULES = 3
} ADC_MODULE_ID;

#define DRV_ADC_INSTANCES_NUMBER 1

#define DRV_ADC_COUNT ADC_NUMBER_OF_MODULES

typedef struct {
  /* The module index associated with the object*/
  ADC_MODULE_ID moduleId;

  /* Flag to indicate this object is in use  */
  bool inUse;

  /* Hardware instance mutex */
  OSAL_MUTEX_DECLARE(mutexDriverInstance);

} DRV_ADC_OBJ;

typedef struct _DRV_ADC_INIT {
  ADC_MODULE_ID adcID;
  uint32_t sync_mode;
  uint32_t prescaler;
  uint32_t DataAlign;
  uint32_t ScanConvMode;
  uint32_t ContinuousConvMode;
  uint32_t ExternalTrigConv;
  uint32_t NbrOfConversion;
} DRV_ADC_INIT;

#ifdef __cplusplus
}
#endif

#endif // #ifndef _DRV_ADC_DEFINITIONS_H
/*******************************************************************************
 End of File
*/
